-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add autofill support to ios text input plugin #17493
Add autofill support to ios text input plugin #17493
Conversation
5366c54
to
0d195a6
Compare
0b7faea
to
e87f36f
Compare
600d9f7
to
c306f8c
Compare
@@ -534,6 +534,11 @@ - (void)updateEditingClient:(int)client withState:(NSDictionary*)state { | |||
arguments:@[ @(client), state ]]; | |||
} | |||
|
|||
- (void)updateEditingClient:(int)client withState:(NSDictionary*)state withTag:(NSString*)tag { | |||
[_textInputChannel.get() invokeMethod:@"TextInputClient.updateEditingStateWithTag" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be safer if you used performSelector:withObject:withObject: https://developer.apple.com/documentation/objectivec/1418956-nsobject/1418667-performselector?language=objc
That will give you static analysis that the method you are invoking exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @"TextInputClient.updateEditingStateWithTag"
does not represent an objective-c selector but a platform message (that will be received and handled by some dart code)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, you're right.
@@ -10,6 +10,9 @@ | |||
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterChannels.h" | |||
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h" | |||
|
|||
#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: This will be unnecessary after #17624 lands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was talking about the "FLUTTER_EXPORT" not being needed once that lands. We used to have to export things we wanted to tests, now tests live with the code so it isn't necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please date the PR with a more descriptive title.
[super dealloc]; | ||
} | ||
|
||
- (void)setTextInputClient:(int)client { | ||
_textInputClient = client; | ||
} | ||
|
||
- (void)setAutofillId:(NSString*)autofillId { | ||
_autofillId = [autofillId copy]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't release the old value. Instead of writing this you can just do@property(nonatomic, copy) NSString* autofillId
to have one automatically generated. Put it in the .mm file to make it private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review! I have to put the interface in the header file in order to be able to import that in a unit test (at least for now). Does adding autorelease
after copy
work here too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh your pull request is already merged. I guess that means I can move the interface back to the .mm file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, autorelease can be used on any object.
} else { | ||
_activeView = _view; | ||
NSAssert(clientUniqueId != nil, @"The client's unique id can't be null"); | ||
for (FlutterTextInputView* v in _inputViews) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i < 10; i++)
BlowTheHorn(); // AVOID.
http://google.github.io/styleguide/objcguide.html#conditionals
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry i didn't put all my comments all together in one review, i'm done now =)
a38471f
to
ca9262e
Compare
ca9262e
to
bec64d3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just threw on a change with my outstanding comments into a patch. LGTM now.
Framework PR: flutter/flutter#52126
Moved
FlutterTextInputView
's interface to the header file in order to expose it in unit tests.